/*
 * @Author: 杰编程 2306248989@qq.com
 * @Date: 2023-08-07 19:21:38
 * @LastEditors: 杰编程 2306248989@qq.com
 * @LastEditTime: 2023-08-07 19:22:42
 * @FilePath: /lesson26/NetCacul/Ulit.hpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#pragma once

#include <iostream>
#include <string>
#include <vector>


using namespace std;

class Util
{
public:
    static bool StringSplit(const string &str, const string &sep, vector<string> *v)
    {
        size_t start = 0;
        while (start < str.size())
        {
            auto pos = str.find(sep, start);
            if (pos == std::string::npos)
                break;
            std::string tmp = str.substr(start, pos - start);
            v->push_back(tmp);
            start = pos + sep.size();
        }
        if (start < str.size())
        {
            std::string tmp = str.substr(start);
            v->push_back(tmp);
        }
        return true;
    }
};